package com.jbookshelf.dal.entities;

// Generated 23.11.2012 22:05:17 by Hibernate Tools 3.6.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Users generated by hbm2java
 */
@Entity
@Table(name = "USERS", schema = "PUBLIC", catalog = "PUBLIC", uniqueConstraints = {
		@UniqueConstraint(columnNames = "LOGIN"),
		@UniqueConstraint(columnNames = "EMAIL") })
public class Users implements java.io.Serializable {

	private Integer id;
	private String firstName;
	private String lastName;
	private String email;
	private String login;
	private String password;
	private boolean isBlocked;
	private Set<UsersPermissions> usersPermissionsesForGrantedBy = new HashSet<UsersPermissions>(
			0);
	private Set<UsersPermissions> usersPermissionsesForUserId = new HashSet<UsersPermissions>(
			0);

	public Users() {
	}

	public Users(String firstName, String lastName, String password,
			boolean isBlocked) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.password = password;
		this.isBlocked = isBlocked;
	}

	public Users(String firstName, String lastName, String email, String login,
			String password, boolean isBlocked,
			Set<UsersPermissions> usersPermissionsesForGrantedBy,
			Set<UsersPermissions> usersPermissionsesForUserId) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.email = email;
		this.login = login;
		this.password = password;
		this.isBlocked = isBlocked;
		this.usersPermissionsesForGrantedBy = usersPermissionsesForGrantedBy;
		this.usersPermissionsesForUserId = usersPermissionsesForUserId;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "FIRST_NAME", nullable = false, length = 128)
	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	@Column(name = "LAST_NAME", nullable = false, length = 128)
	public String getLastName() {
		return this.lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	@Column(name = "EMAIL", unique = true, length = 128)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "LOGIN", unique = true, length = 128)
	public String getLogin() {
		return this.login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	@Column(name = "PASSWORD", nullable = false, length = 512)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "IS_BLOCKED", nullable = false)
	public boolean isIsBlocked() {
		return this.isBlocked;
	}

	public void setIsBlocked(boolean isBlocked) {
		this.isBlocked = isBlocked;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "usersByGrantedBy")
	public Set<UsersPermissions> getUsersPermissionsesForGrantedBy() {
		return this.usersPermissionsesForGrantedBy;
	}

	public void setUsersPermissionsesForGrantedBy(
			Set<UsersPermissions> usersPermissionsesForGrantedBy) {
		this.usersPermissionsesForGrantedBy = usersPermissionsesForGrantedBy;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "usersByUserId")
	public Set<UsersPermissions> getUsersPermissionsesForUserId() {
		return this.usersPermissionsesForUserId;
	}

	public void setUsersPermissionsesForUserId(
			Set<UsersPermissions> usersPermissionsesForUserId) {
		this.usersPermissionsesForUserId = usersPermissionsesForUserId;
	}

}
